package example.config;


//import jdk.nashorn.internal.runtime.regexp.joni.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.lang.annotation.Documented;

@EnableSwagger2
@Configuration
public class Swagger2Configuration {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)

                .apiInfo(ApiInfo())
                .select()

        //通过.select()方法，去配置扫描接口,RequestHandlerSelectors配置如何扫描接口
        .apis(RequestHandlerSelectors.basePackage("com.example.controller"))

         .build();

    }
    // API 文档的详细信息函数
    private ApiInfo ApiInfo(){
        return new ApiInfoBuilder()
                .title("网上商城API")
                .description("去微软")
                .version("v1.0")
                .contact(new Contact("tom","","2722260630.com"))
                .build();
    }
    }
